﻿  function MoneyFormat(aiMoney,aiMaxOut){ //大写人民币转换(以分为单位)   
  if   (!aiMaxOut){aiMaxOut   =   7;}   
  lcMoney   =   parseFloat(aiMoney)+"";   
  if   (lcMoney=='NaN'){lcMoney='0.00'}   
  if   (lcMoney.indexOf('.')==-1){   
                  lcMoney=lcMoney+".00"   
            }else{   
                  lcMoney=lcMoney.substring(0,lcMoney.indexOf('.')+3)   
            if   (((lcMoney.substring(lcMoney.indexOf('.'))).length)==2){lcMoney=lcMoney+'0'}   
  }   
  lcMoneyNs   =   lcMoney;   
  lcMoney   =   lcMoney.replace('.','')   
  lcMoney   =   lcMoney.replace('-','')   
  var   liLength=lcMoney.length   ,   lcFormat="";   
  for   (i=1;   i<=(aiMaxOut-liLength);   i++){   
  lcMoney   =   '0'   +   lcMoney;   
  }   
  if   (liLength>aiMaxOut){lcFormat   =   '无金额!';aiMaxOut=0;}   
  liLength=aiMaxOut;   
  var   AlterlcMoney=   new   Array();   
  AlterlcMoney[0]="零";AlterlcMoney[1]="壹";AlterlcMoney[2]="贰";AlterlcMoney[3]="叁";AlterlcMoney[4]="肆";AlterlcMoney[5]="伍";AlterlcMoney[6]="陆";AlterlcMoney[7]="柒";AlterlcMoney[8]="捌";AlterlcMoney[9]="玖";   
  for   (i=1;   i<=liLength;   i++){   
  var   liTempMoney   =   parseFloat(lcMoney.substring(liLength-i));   
  lcMoney   =   lcMoney.substring(0,liLength-i);   
  if   (i==1){lcFormat   ="分"   +   lcFormat;}   
  if   (i==2){lcFormat   ="角"   +   lcFormat;}   
  if   (i==3){lcFormat   ="圆"   +   lcFormat;}   
  if   (i==4){lcFormat   ="拾"   +   lcFormat;}   
  if   (i==5){lcFormat   ="佰"   +   lcFormat;}   
  if   (i==6){lcFormat   ="仟"   +   lcFormat;}   
  if   (i==7){lcFormat   ="万"   +   lcFormat;}   
  if   (i==8){lcFormat   ="拾"   +   lcFormat;}   
  if   (i==9){lcFormat   ="佰"   +   lcFormat;}   
  if   (i==10){lcFormat   ="仟"+   lcFormat;}   
  lcFormat   =   AlterlcMoney[liTempMoney]   +   lcFormat;   
  }   
  lcMoney   =   lcFormat.substring(0,lcFormat.length-4)+"整";
  if(lcMoney == "整"){lcMoney=""}
  return   lcMoney;
  } 
  function convert(money)
  {  	
  	document.all.RMBCap.value=MoneyFormat(money,money.length+2);
  }